home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Games / NeXTmj / Source / Tile.h < prev    next >
C/C++ Source or Header  |  1991-03-13  |  2KB  |  66 lines

  1.  
  2. /*
  3.  * This is the base class for tiles.
  4.  *
  5.  $Author$
  6.  $Header$
  7.  *
  8.  $Log$
  9.  */
  10.  
  11. extern "Objective-C" {
  12. #import    <appkit/NXImage.h>
  13. #import    <appkit/View.h>
  14. }
  15.  
  16.  
  17.                                                 // Some tiles need to be shifted by this
  18.                                                 //    amount so that a 3d effect can be
  19.                                                 //    acheived.
  20. #define    TILE_SHIFT    5
  21.  
  22.  
  23.                                                 // Each tile is a square.  This constant
  24.                                                 //    reflects the pixels high and wide for
  25.                                                 //    a tile.
  26. #define    TILE_SIZE    64
  27.  
  28.  
  29. class Tile {
  30.  
  31. protected:
  32.                                                 // This is a Image object which is
  33.                                                 //    loaded with a tiff image and used
  34.                                                 //    to display a tile.
  35.     NXImage    *my_tile_image;
  36.                                                 // This member function is called by 
  37.                                                 //    subclasses to load a tiff file for
  38.                                                 //    tile rendering.
  39.     void    loadImageFromFile( const char * );
  40.  
  41. protected:
  42.                                                 // This function does the actual drawing of
  43.                                                 //    an image to a point on the board.  All
  44.                                                 //    of the drawImage() routine call this.
  45.                                                 // The first parameter is a point on the
  46.                                                 //    board where the tile is drawn, the 
  47.                                                 //    second parameter is the composite
  48.                                                 //    operation.
  49.     void    compositeImage( NXPoint, int );
  50. public:
  51.                                                 // This member function is called by the
  52.                                                 //    Board View to composite the tile a
  53.                                                 //    a location within the view. (The focus
  54.                                                 //    of the view must have been locked 
  55.                                                 //    previously.)
  56.                                                 // This member function must be implemented
  57.                                                 //    in the subclasses since game tiles 
  58.                                                 //    can be highlighted.
  59.     virtual void    drawImage( NXPoint ) = 0;
  60.  
  61. public:
  62.     Tile( void );
  63.     ~Tile( void );
  64. };
  65.  
  66.